Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Get the childrens of an element in react native using useRef

import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View, TextInput, TouchableOpacity} from "react-native";
import { useRef, forwardRef} from "react";

const TextInputComponent = forwardRef<TextInput>((props, ref) => {
  return (
    <View>
      <Text>Email</Text>
      <TextInput ref={ref} placeholder="Some placeholder" />
    </View>
  );
});

export default function App() {
  const input = useRef<TextInput>(null)

  return (
    <View style={styles.container}>
      <Text>Open up App.tsx to start working on your app!</Text>
      <StatusBar style="auto" />
      <TouchableOpacity onPress={() => {
input.current?.focus();
      }}>
        <TextInputComponent ref={input} />
      </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: adding text to ant media stream 
Javascript :: How to hover over data inserted from JSON 
Javascript :: What is the best way to download mulitple images using jquery 
Javascript :: async mutex 
Javascript :: Render JOSN in frontend 
Javascript :: gradient of a function 
Javascript :: assignment is to create a small website using NestJS in the backend and basic HTML CSS in the frontend 
Javascript :: fireOnChange 
Javascript :: Streaming search queries with Node.js and Socket.io (streaming to a given socket 
Javascript :: C# Convert Json File to DataTable using Newtonsoft.Json DLL 
Javascript :: javascript check if key is keydown is charcter 
Javascript :: react native push notifications cancel delivered notification 
Javascript :: laravel sending email to outlook link not working 
Javascript :: leap year list 
Javascript :: bullet mechanism in phaser 
Javascript :: inspect vuex store 
Javascript :: js redirection captive portal 
Javascript :: Self Invoking Function Tip 
Javascript :: empty or remove div span class 
Javascript :: Object.entries() To Use For Of On JSON 
Javascript :: prisma Return a relations count with include 
Javascript :: how to skip the else statment in react tertiary 
Javascript :: errors thrown inside asynchronous functions will act like uncaught errors 
Javascript :: wp include js 
Javascript :: Backbone Model Setting, Has And Getting 
Javascript :: Backbone Sync And Fetch 
Javascript :: How to Check if an Item is in an Array in JavaScript Using Array.includes() Starting From a Specified Index 
Javascript :: empty an array in javascript 
Javascript :: convert 12 hour to 24 hour javascript 
Javascript :: moment duration 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =