https://github.com/anmolsukki/react-native-basics
https://github.com/anmolsukki/react-native-basics
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/anmolsukki/react-native-basics
- Owner: anmolsukki
- Created: 2021-03-21T23:11:55.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-15T13:54:57.000Z (over 3 years ago)
- Last Synced: 2025-02-02T05:41:32.506Z (3 months ago)
- Language: JavaScript
- Size: 729 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### React Native Basics
#### KeyboardAvoidingView
```jsx
import { View, KeyboardAvoidingView } from 'react-native';...
;
```#### Detect Update Orientation
```jsx
import React, { useState, useEffect } from 'react';
import { View, Dimensions } from 'react-native';const [buttonWidth, setButtonWidth] = useState(Dimensions.get('window').width / 4);
useEffect(() => {
const updateLayout = () => {
setButtonWidth(Dimensions.get('window').width / 4)
}Dimensions.addEventListener("change", updateLayout)
return () => {
Dimensions.removeEventListener("change", updateLayout)
}
})...
```#### Platform
```jsx
import { View, Platform } from 'react-native';{Platform.OS === 'ios' ? 'IOS' : 'Android'}
;
```