I want to use the value of a custom component as magic text

I have created a simple custom component. How can I pass this value to magic text like a normal component?

You want to pass the value of the zipcode to another component.

import React, { useState } from 'react'
import { TextInput, View, StyleSheet } from 'react-native'

const ZipcodeAddress = (props) => {
	const { color, text } = props
	const [zipcode, setZipcode] = useState('')
  
	return (
	  <View style={styles.container}>
		<TextInput
		  style={styles.input}
		  value={zipcode}
		  onChangeText={text => setZipcode(text)}
		  placeholder="text"
		/>
	  </View>
	)
  }
  
  const styles = StyleSheet.create({
	container: {
	  padding: 8
	},
	input: {
	  borderWidth: 1,
	  borderColor: '#ccc',
	  borderRadius: 4,
	  padding: 8
	}
  })
  
  export default ZipcodeAddress

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.