1605595920
A performant interactive bottom sheet with fully configurable options 🚀
Initially, this project was a cloned of
react-native-scroll-bottom-sheet
by @rgommezz ❤️. However, it is been fully re-written to add extra functionalities and simplify the approach.
FlatList
, SectionList
, ScrollView
& View
scrolling interactions.React Navigation
Integration.Reanimated
v1 & v2.Expo
.TypeScript
.This version is written with Reanimated v1
yarn add @gorhom/bottom-sheet
# or
npm install @gorhom/bottom-sheet
⚠️ You need to install react-native-reanimated & react-native-gesture-handler and follow their installation instructions.
this version is written with Reanimated v2
, although this version is still in alpha phase, yet it provides all version 1 functionalities with the huge performance boost, thanks to Reanimated v2
❤️
yarn add @gorhom/bottom-sheet@2.0.0-alpha.0
# or
npm install @gorhom/bottom-sheet@2.0.0-alpha.0
⚠️ You need to install react-native-reanimated v2 & react-native-gesture-handler and follow their installation instructions.
import React, { useCallback, useMemo, useRef } from 'react';
import { View, StyleSheet } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';
const App = () => {
// hooks
const bottomSheetRef = useRef<BottomSheet>(null);
// variables
const snapPoints = useMemo(() => ['25%', '50%', '90%'], []);
// callbacks
const handleSheetChanges = useCallback((index: number) => {
console.log('handleSheetChanges', index);
}, []);
// renders
return (
<View style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
initialSnapIndex={1}
snapPoints={snapPoints}
onChange={handleSheetChanges}
>
{/* INSERT A SCROLLABLE HERE */}
</BottomSheet>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
},
});
export default App;
initialSnapIndex
Initial snap index. You also could provide {-1
} to initiate bottom sheet in closed state.
required:
NO |type:
number |default:
0
snapPoints
Points for the bottom sheet to snap to, points should be sorted from bottom to top
. It accepts array of number, string or mix. String values should be a percentage.
required:
YES |type:
Array<string | number>
example:
[100, ‘50%’, ‘90%’]
topInset
Top inset value helps to calculate percentage snap points values. usually comes from @react-navigation/stack
hook useHeaderHeight
or from react-native-safe-area-context
hook useSafeArea
.
required:
NO |type:
number |default:
0
enabled
To enable or disable user interaction with the sheet.
required:
NO |type:
boolean |default:
true
animationDuration
Snapping animation duration.
required:
NO |type:
number |default:
500
animationEasing
Snapping animation easing function.
required:
NO |type:
Animated.EasingFunction |default:
Easing.out(Easing.back(0.75))
animatedPosition
Animated value to be used as a callback for the position node internally.
required:
NO |type:
Animated.Value
animatedPositionIndex
Animated value to be used as a callback for the position index node internally.
required:
NO |type:
Animated.Value
handleComponent
Component to be placed as a sheet handle.
required:
NO |type:
React.FC<BottomSheetHandleProps>
backgroundComponent
Component to be placed as a background.
required:
NO |type:
React.FC
onChange
Callback when sheet position changed to a provided point.
required:
NO |type:
(index: number) => void
children
A scrollable node or normal view.
required:
YES |type:
() => React.ReactNode | React.ReactNode[] | React.ReactNode
snapTo
Snap to one of the provided points from snapPoints
.
type:
(index: number) => void
expand
Snap to the maximum provided point from snapPoints
.
type:
() => void
collapse
Snap to the minimum provided point from snapPoints
.
type:
() => void
close
Close the bottom sheet.
type:
() => void
useBottomSheet
The library provide useBottomSheet
hook to provide the bottom sheet methods, anywhere inside the sheet content.
type:
BottomSheetMethods
This library provides a pre-integrated views that utilise an internal functionalities with the bottom sheet to allow smooth interactions. These views i called them Scrollables
and they are:
reanimated-bottom-sheet
or react-native-scroll-bottom-sheet
?This library was built to provide the most native-like experience and could fit any use-case that developers wants it to be.
While both libraries providing similar experience, but they still missing the following:
reanimated-bottom-sheet
- Seamless gesture interaction between the sheet and the content.
react-native-scroll-bottom-sheet
- Extracting scrollable content to allow developers customize the sheet content, like integrate
React Navigation
as the sheet content.Both libraries are great! and I have used both of them at my work ❤️
React Navigation
?here you go React Navigation Integration :)
Reanimated v2
?Yes 🎉
Author: gorhom
Source Code: https://github.com/gorhom/react-native-bottom-sheet
#react #react-native #mobile-apps
1598839687
If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?
In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.
Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.
React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.
Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.
Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.
The popularity of React Native comes from its advantages. Some of its advantages are as follows:
Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.
React Native is very close to native. Consider the following aspects as described on the React Native website:
Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.
#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native
1655715965
En esta guía, aprenderá cómo crear impresionantes botones de radio personalizados usando solo HTML y CSS. Para crear impresionantes botones de radio personalizados usando solo HTML y CSS. Primero, debe crear dos archivos, un archivo HTML y otro es un archivo CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Radio Buttons | Codequs</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="title">Select your option</div>
<div class="box">
<input type="radio" name="select" id="option-1">
<input type="radio" name="select" id="option-2">
<input type="radio" name="select" id="option-3">
<input type="radio" name="select" id="option-4">
<label for="option-1" class="option-1">
<div class="dot"></div>
<div class="text">Gamer</div>
</label>
<label for="option-2" class="option-2">
<div class="dot"></div>
<div class="text">YouTuber</div>
</label>
<label for="option-3" class="option-3">
<div class="dot"></div>
<div class="text">Student</div>
</label>
<label for="option-4" class="option-4">
<div class="dot"></div>
<div class="text">Developer</div>
</label>
</div>
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
html,body{
display: grid;
height: 100%;
place-items: center;
}
.wrapper{
width: 350px;
background: #fff;
border-radius: 10px;
box-shadow: 5px 5px 30px rgba(0,0,0,0.2);
}
.wrapper .title{
color: #fff;
line-height: 65px;
text-align: center;
background: #333;
font-size: 25px;
font-weight: 500;
border-radius: 10px 10px 0 0;
}
.wrapper .box{
padding: 20px 30px;
background: #fff;
border-radius: 10px;
}
.wrapper .box label{
display: flex;
height: 53px;
width: 100%;
align-items: center;
border: 1px solid lightgrey;
border-radius: 50px;
margin: 10px 0;
padding-left: 20px;
cursor: default;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1,
#option-2:checked ~ .option-2,
#option-3:checked ~ .option-3,
#option-4:checked ~ .option-4{
background: #333;
border-color: #333;
}
.wrapper .box label .dot{
height: 20px;
width: 20px;
background: #d9d9d9;
border-radius: 50%;
position: relative;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot,
#option-2:checked ~ .option-2 .dot,
#option-3:checked ~ .option-3 .dot,
#option-4:checked ~ .option-4 .dot{
background: #fff;
}
.box label .dot::before{
position: absolute;
content: "";
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(2);
width: 9px;
height: 9px;
border-radius: 50%;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot::before,
#option-2:checked ~ .option-2 .dot::before,
#option-3:checked ~ .option-3 .dot::before,
#option-4:checked ~ .option-4 .dot::before{
background: #333;
transform: translate(-50%, -50%) scale(1);
}
.wrapper .box label .text{
color: #333;
font-size: 18px;
font-weight: 400;
padding-left: 10px;
transition: color 0.3s ease;
}
#option-1:checked ~ .option-1 .text,
#option-2:checked ~ .option-2 .text,
#option-3:checked ~ .option-3 .text,
#option-4:checked ~ .option-4 .text{
color: #fff;
}
.wrapper .box input[type="radio"]{
display: none;
}
Ahora ha creado con éxito impresionantes botones de radio personalizados usando solo HTML y CSS.
1655727060
In diesem Leitfaden erfahren Sie, wie Sie fantastische benutzerdefinierte Optionsfelder nur mit HTML und CSS erstellen. Um fantastische benutzerdefinierte Optionsfelder nur mit HTML und CSS zu erstellen. Zuerst müssen Sie zwei Dateien erstellen, eine HTML-Datei und eine CSS-Datei.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Radio Buttons | Codequs</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="title">Select your option</div>
<div class="box">
<input type="radio" name="select" id="option-1">
<input type="radio" name="select" id="option-2">
<input type="radio" name="select" id="option-3">
<input type="radio" name="select" id="option-4">
<label for="option-1" class="option-1">
<div class="dot"></div>
<div class="text">Gamer</div>
</label>
<label for="option-2" class="option-2">
<div class="dot"></div>
<div class="text">YouTuber</div>
</label>
<label for="option-3" class="option-3">
<div class="dot"></div>
<div class="text">Student</div>
</label>
<label for="option-4" class="option-4">
<div class="dot"></div>
<div class="text">Developer</div>
</label>
</div>
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
html,body{
display: grid;
height: 100%;
place-items: center;
}
.wrapper{
width: 350px;
background: #fff;
border-radius: 10px;
box-shadow: 5px 5px 30px rgba(0,0,0,0.2);
}
.wrapper .title{
color: #fff;
line-height: 65px;
text-align: center;
background: #333;
font-size: 25px;
font-weight: 500;
border-radius: 10px 10px 0 0;
}
.wrapper .box{
padding: 20px 30px;
background: #fff;
border-radius: 10px;
}
.wrapper .box label{
display: flex;
height: 53px;
width: 100%;
align-items: center;
border: 1px solid lightgrey;
border-radius: 50px;
margin: 10px 0;
padding-left: 20px;
cursor: default;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1,
#option-2:checked ~ .option-2,
#option-3:checked ~ .option-3,
#option-4:checked ~ .option-4{
background: #333;
border-color: #333;
}
.wrapper .box label .dot{
height: 20px;
width: 20px;
background: #d9d9d9;
border-radius: 50%;
position: relative;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot,
#option-2:checked ~ .option-2 .dot,
#option-3:checked ~ .option-3 .dot,
#option-4:checked ~ .option-4 .dot{
background: #fff;
}
.box label .dot::before{
position: absolute;
content: "";
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(2);
width: 9px;
height: 9px;
border-radius: 50%;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot::before,
#option-2:checked ~ .option-2 .dot::before,
#option-3:checked ~ .option-3 .dot::before,
#option-4:checked ~ .option-4 .dot::before{
background: #333;
transform: translate(-50%, -50%) scale(1);
}
.wrapper .box label .text{
color: #333;
font-size: 18px;
font-weight: 400;
padding-left: 10px;
transition: color 0.3s ease;
}
#option-1:checked ~ .option-1 .text,
#option-2:checked ~ .option-2 .text,
#option-3:checked ~ .option-3 .text,
#option-4:checked ~ .option-4 .text{
color: #fff;
}
.wrapper .box input[type="radio"]{
display: none;
}
Jetzt haben Sie erfolgreich fantastische benutzerdefinierte Optionsfelder nur mit HTML und CSS erstellt.
1655723340
このガイドでは、HTMLとCSSのみを使用して素晴らしいカスタムラジオボタンを作成する方法を学習します。HTMLとCSSのみを使用して素晴らしいカスタムラジオボタンを作成します。まず、2つのファイルを作成する必要があります。1つはHTMLファイルで、もう1つはCSSファイルです。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Radio Buttons | Codequs</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="title">Select your option</div>
<div class="box">
<input type="radio" name="select" id="option-1">
<input type="radio" name="select" id="option-2">
<input type="radio" name="select" id="option-3">
<input type="radio" name="select" id="option-4">
<label for="option-1" class="option-1">
<div class="dot"></div>
<div class="text">Gamer</div>
</label>
<label for="option-2" class="option-2">
<div class="dot"></div>
<div class="text">YouTuber</div>
</label>
<label for="option-3" class="option-3">
<div class="dot"></div>
<div class="text">Student</div>
</label>
<label for="option-4" class="option-4">
<div class="dot"></div>
<div class="text">Developer</div>
</label>
</div>
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
html,body{
display: grid;
height: 100%;
place-items: center;
}
.wrapper{
width: 350px;
background: #fff;
border-radius: 10px;
box-shadow: 5px 5px 30px rgba(0,0,0,0.2);
}
.wrapper .title{
color: #fff;
line-height: 65px;
text-align: center;
background: #333;
font-size: 25px;
font-weight: 500;
border-radius: 10px 10px 0 0;
}
.wrapper .box{
padding: 20px 30px;
background: #fff;
border-radius: 10px;
}
.wrapper .box label{
display: flex;
height: 53px;
width: 100%;
align-items: center;
border: 1px solid lightgrey;
border-radius: 50px;
margin: 10px 0;
padding-left: 20px;
cursor: default;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1,
#option-2:checked ~ .option-2,
#option-3:checked ~ .option-3,
#option-4:checked ~ .option-4{
background: #333;
border-color: #333;
}
.wrapper .box label .dot{
height: 20px;
width: 20px;
background: #d9d9d9;
border-radius: 50%;
position: relative;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot,
#option-2:checked ~ .option-2 .dot,
#option-3:checked ~ .option-3 .dot,
#option-4:checked ~ .option-4 .dot{
background: #fff;
}
.box label .dot::before{
position: absolute;
content: "";
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(2);
width: 9px;
height: 9px;
border-radius: 50%;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot::before,
#option-2:checked ~ .option-2 .dot::before,
#option-3:checked ~ .option-3 .dot::before,
#option-4:checked ~ .option-4 .dot::before{
background: #333;
transform: translate(-50%, -50%) scale(1);
}
.wrapper .box label .text{
color: #333;
font-size: 18px;
font-weight: 400;
padding-left: 10px;
transition: color 0.3s ease;
}
#option-1:checked ~ .option-1 .text,
#option-2:checked ~ .option-2 .text,
#option-3:checked ~ .option-3 .text,
#option-4:checked ~ .option-4 .text{
color: #fff;
}
.wrapper .box input[type="radio"]{
display: none;
}
これで、HTMLとCSSのみを使用して素晴らしいカスタムラジオボタンを正常に作成できました。
1655719680
Dans ce guide, vous apprendrez à créer des boutons radio personnalisés impressionnants en utilisant uniquement HTML et CSS. Pour créer des boutons radio personnalisés impressionnants en utilisant uniquement HTML et CSS. Tout d'abord, vous devez créer deux fichiers, un fichier HTML et un autre fichier CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Custom Radio Buttons | Codequs</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div class="title">Select your option</div>
<div class="box">
<input type="radio" name="select" id="option-1">
<input type="radio" name="select" id="option-2">
<input type="radio" name="select" id="option-3">
<input type="radio" name="select" id="option-4">
<label for="option-1" class="option-1">
<div class="dot"></div>
<div class="text">Gamer</div>
</label>
<label for="option-2" class="option-2">
<div class="dot"></div>
<div class="text">YouTuber</div>
</label>
<label for="option-3" class="option-3">
<div class="dot"></div>
<div class="text">Student</div>
</label>
<label for="option-4" class="option-4">
<div class="dot"></div>
<div class="text">Developer</div>
</label>
</div>
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
html,body{
display: grid;
height: 100%;
place-items: center;
}
.wrapper{
width: 350px;
background: #fff;
border-radius: 10px;
box-shadow: 5px 5px 30px rgba(0,0,0,0.2);
}
.wrapper .title{
color: #fff;
line-height: 65px;
text-align: center;
background: #333;
font-size: 25px;
font-weight: 500;
border-radius: 10px 10px 0 0;
}
.wrapper .box{
padding: 20px 30px;
background: #fff;
border-radius: 10px;
}
.wrapper .box label{
display: flex;
height: 53px;
width: 100%;
align-items: center;
border: 1px solid lightgrey;
border-radius: 50px;
margin: 10px 0;
padding-left: 20px;
cursor: default;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1,
#option-2:checked ~ .option-2,
#option-3:checked ~ .option-3,
#option-4:checked ~ .option-4{
background: #333;
border-color: #333;
}
.wrapper .box label .dot{
height: 20px;
width: 20px;
background: #d9d9d9;
border-radius: 50%;
position: relative;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot,
#option-2:checked ~ .option-2 .dot,
#option-3:checked ~ .option-3 .dot,
#option-4:checked ~ .option-4 .dot{
background: #fff;
}
.box label .dot::before{
position: absolute;
content: "";
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(2);
width: 9px;
height: 9px;
border-radius: 50%;
transition: all 0.3s ease;
}
#option-1:checked ~ .option-1 .dot::before,
#option-2:checked ~ .option-2 .dot::before,
#option-3:checked ~ .option-3 .dot::before,
#option-4:checked ~ .option-4 .dot::before{
background: #333;
transform: translate(-50%, -50%) scale(1);
}
.wrapper .box label .text{
color: #333;
font-size: 18px;
font-weight: 400;
padding-left: 10px;
transition: color 0.3s ease;
}
#option-1:checked ~ .option-1 .text,
#option-2:checked ~ .option-2 .text,
#option-3:checked ~ .option-3 .text,
#option-4:checked ~ .option-4 .text{
color: #fff;
}
.wrapper .box input[type="radio"]{
display: none;
}
Vous avez maintenant créé avec succès des boutons radio personnalisés impressionnants en utilisant uniquement HTML et CSS.