Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda