Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
How can i change text data with RNPickerSelect?

this is my code

            const [innerState, setInnerState] = useState<any>({
                    instar: 'egg',
                    recordFeedPeriod: 'N',
                    feedPeriod: '', 
                    feedAmount: 0, 
                    feedType: 'bbong', 
                    totalFeedAmount: 0, 
                })

            const [textboolen, setTextboolen] =  useState<boolean>(false)


            export const productFeed49 = Object.freeze([
                { label: 'a', value: 'Tangerinefeed' },
                { label: 'd', value: 'dryexamfeed' },
                { label: 'c', value: 'wetfeed' },
                { label: 'd', value: 'sawdust' },
                { label: 'e', value: 'etc' },
            ]);


            const onChangeInnerPicker = ({ name, data }: { name: string; data: string }) => {
                try {
                    setInnerState({ ...innerState, [name]: data });
                } catch (err: any) {
                }
            }


            useEffect(() => {
            
                if(innerState.feedType === 'etc') {
                    setTextboolen(true)
                } else if (innerState.feedType === 'Tangerinefeed' || 'dryexamfeed' || 'wetfeed' || 'sawdust') {
                    setTextboolen(false)
                }
            },[innerState.feedType]);

            const onChangeEtcfeedtype = useCallback((text) => {
                 setInnerState({...innerState, ['feedType']: text})
            },[]);


            <View style={insertSubPageStyle.subCoumnWrapper}>
                            <RNPickerSelect
                                value={innerState.feedType}
                                items={productFeed49}
                                onValueChange={data => onChangeInnerPicker({ name, data })}
                            />
                        </View>
                        {textboolen ? (
                        <View style={insertSubPageStyle.etcContainer}>
                            <TextInput
                            placeholder="write."
                            value={innerState.feedType}
                            onChangeText={onChangeEtcfeedtype}
                            />
                            </View>
                    ) : (null)}
                    </View >

When I use RNPickerSelect to select etc data, I want textboolen to become true to create a TextInput component, input it there, and change innerState.feedType to process the value.

However, when I use my code, when I input something into textInput, the textinput window disappears and I cannot change the innerState.feedType value. How do I fix the code?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!