What is an alternative of textarea in react-native?

Yes there is. It’s called TextInput, the normal TextInput Component supports multiple lines. Just assign following properties to your TextInput Component multiline = {true} numberOfLines = {4} At the end you should have this: <TextInput multiline={true} numberOfLines={4} onChangeText={(text) => this.setState({text})} value={this.state.text}/> Source https://facebook.github.io/react-native/docs/textinput

What is metro bundler in react-native?

A React Native app is a compiled app that is running some Javascript. Whenever you build and run your React Native project, a packager starts up called Metro. You’ve probably seen this output in your terminal before, letting your know the packager is running. The packager does a few things: Combines all your Javascript code … Read more

React Native styling with conditional

Use StyleSheet.create to do style composition like this, make styles for text, valid text, and invalid text. const styles = StyleSheet.create({ text: { height: 40, backgroundColor: ‘white’, borderRadius: 5, padding: 10, }, textvalid: { borderWidth: 2, }, textinvalid: { borderColor: ‘red’, }, }); and then group them together with an array of styles. <TextInput style={[styles.text, … Read more

Getting this error: error: bundling failed: Error: Unable to resolve module `react-native-safe-area-context`

I think the problem is in the SafeAreaView, for the new react-native version, it has migrated to react-native-community/react-native-safe-area-view. if you want to use SafeAreaView, you should install it first. the new use is like this: import SafeAreaView from ‘react-native-safe-area-view’; export default function MyAwesomeApp() { return ( <SafeAreaView style={{ flex: 1 }}> <View style={{ flex: 1 … Read more

Scroll to top of ScrollView

in functional components import { useRef } from ‘react’; const scrollRef = useRef(); const onPressTouch = () => { scrollRef.current?.scrollTo({ y: 0, animated: true, }); } <ScrollView ref={scrollRef}> …your elements </ScrollView> <TouchableOpacity onPress={onPressTouch}></TouchableOpacity>

How can I use javascript library such as moment.js in react native

Easy peasy! From the root of your project just run: npm install moment –save Then you can import it in your code: import moment from ‘moment’; var now = moment().format(); The restrictions would be anything that tries to “reach out” to the browser (which doesn’t exist in this context). That’s why there’s polyfills for things … Read more