REACT NATIVE
1. To install expo cli use command
npm install -g expo-cli
2. To create a new project in expo use below command
expo init projectname
3. In react native h2 tag and div are not working as it has no react dom and we are building the react native app
4. React native don't have dom and they do not support those html element
5. div replace with view and input replace with TextInput
6. View is only able to hold the other component, not able to display the text
7. View component have multiple child component
8. In web dev we have other component like article, section - here we have only view
9. We can put view inside view - when we build more complex project
10. In normal react you don't have to import the html element but in react native you do
Styling the components:-
11. Here we don't have any css so to style the react native app we have to way
- either we do inline styles
- Stylesheet objects ( Saari style ek object ke andar daal do fir use reuse bhi kr sakte hai) -achi hai
12. Flex basically View ke andar element ko place krne ka kaam krte hai
13. Default settings of FlexDirection is coloum
14. In react native every view uses flexbox by default
15. Flexbox is used to organize child object in one dimensonal space
16. there flex direction are in row by default
17. We can also do row-reverse and coloum-reverse as well
18. Button do not support any side prop
19. Component is a javascript function which return jsx or CreateElement
20. In website if you fill the available space , by default scrollable bar will come up, this is not the case in mobile app we have to write custom scroll view, and there are many props we can send in that scroll view, to make bouncing or some crazy effects which we can pass through props ( official docs is great way to check for the props)
21. Handling event is similar as in react, use the usestate to manage the state on Handleing event section, its very easy
22. In react we use map, to get the list of items into an array of jsx element
23. though we need to write one code and it will work on both android and ios and its true in general, but sometime we have to write the tiny code to make the adjustement in both device
24. lets take an example that if we put style in textInput, there may be difference in the design but if put the style in the view, there will be no difference
25. like in css child element inherit the property from parent element, this is not the case for react native style, some differnce can easily be solved by adding the extra wrapper like view
26. There is some disadvantage of using ScrollView, this is good when you have a long article and you are displaying as in scroll view, but in case of list of items Scroll view is not the good things because if you have hundereds of items , and in your screen only 10 items is displaying at time, but also scroll view get all the hundereds of items that is not the good case
27. For long list, scroll view get the performance issue, For dynamic list we never have to use scroll view, the better solution is another react native component that is flat list
28. Flat list improve the perfromance, when you have large list a large amount of data is not loaded
29. We can use FlatList by replacing Scrollview with flatlist
30. In modern react native code you don't need to import the react in componenets
31. ripple effect means when we click on certain button, wo thoda change hota hai on click pe that is ripple effect
32. importing Modal in react component, for pop and all its built in only
33. There is image component in react to add image image, in order to add the image in react native if we have to specify in source and want to use the require function for giving the path
34. KeyboardAvoidingView
- To handle this scenario, you’ll want to use KeyboardAvoidingView so that whenever the keyboard opens, your fields in focus will be lifted upward to appear above the keyboard.
35. Touchable Opaticity
The TouchableOpacity wrapper is used to reduce the opacity of button. It allows background to be seen while the user press down. The opacity of button will be controlled by wrapping the children in an Animation.
36. Dimension
Here is an Example to Get Device Height Width on Button Click in React Native. We will use Dimensions component of react-native to get the Height and Width of the Device.
In mobile app development, we have to support different screens sizes. Especially if you are working on an App where responsiveness matters a lot then you need to keep track of Device Height and Width. So Let’s get started with the example to get the Device Height Width.
Dimensions.get('window').height
Dimensions.get('window').width
37. React Native Navigation
a)
Comments
Post a Comment