React-Native text gets vertically cut off for no reason

<View style={[styles.itemContainer, { padding: 15 }]}> <Text style={styles.itemHeaderText}>Cut off Text????</Text> </View> The padding should be applied to the Text component instead of the View container: <View style={styles.itemContainer}> <Text style={[styles.itemHeaderText, { padding: 15 }]}>Cut off Text????</Text> </View> Working code: https://snack.expo.io/Hkn9YIC17

How to update a single item in FlatList in React Native?

You can set extraData in FlatList: <FlatList … extraData={this.state} data={this.state.posts} renderItem={this.renderPost} … /> When state.posts or state.posts‘s item change, FlatList will re-render. From FlatList#extradata: A marker property for telling the list to re-render (since it implements PureComponent). If any of your renderItem, Header, Footer, etc. functions depend on anything outside of the data prop, stick … Read more

Is there any way to access the current locale with React-Intl?

New answer – using hooks (see below for original) import { useIntl } from ‘react-intl’; const MyComponent: FC = () => { const intl = useIntl() return <div>{`Current locale: ${intl.locale}`}</div> } export default MyComponent Old answer You can get the current locale in any component of your App by simply accessing it from React Intl’s … Read more

How to optimise an Image in React Native

If you are using react-native-image-picker for uploading images, you can set maxWidth, maxHeight or quality of image for reducing the size. const options = { title: ‘Select Picture’, storageOptions: { skipBackup: true, path: ‘images’, }, maxWidth: 500, maxHeight: 500, quality: 0.5, }; ImagePicker.showImagePicker(options, resolve, reject);