0% found this document useful (0 votes)
12 views

React Native

Uploaded by

DIDUL ADEESHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

React Native

Uploaded by

DIDUL ADEESHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

async storage

AsyncStorage.setItem("user", JSON.stringify(jsObject));

let userjson = await AsyncStorage.getItem("user");

await AsyncStorage.clear();

2. formdata
const fetchFunction = async () => {

let formdata = new FormData();

formdata.append("name", "didul");
formdata.append("age", 19);

try {

let response = await fetch("http://localhost:8080/SmartChat/A", {

method: "POST",

body: formdata,

headers: {

'Content-Type': 'multipart/form-data'
}

});

if (response.ok) {

let json = response.json();

} else {

console, log("Error")

} catch (error) {

console.log(error)

} }

fetchFunction();

}
3. use state
export default function home2() {

const [getCount, setCount] = useState(0);

4. use effect
useEffect(() => {
}, []);

5. pressable
<Pressable onPress={()=>{

router.back(); / Alert.alert("Info", "Content") / router.push("/home") / router.replace("/")

}}>

<Text>Go to Index</Text>

</Pressable>

6. stylesheet
export default function h1() {

return (

<view>

<Text style={styleSheet.text1}>Home page</Text

<view/>

);

const styleSheet = StyleSheet.create({

text1:{

fontSize: 30,

color:'white',

alignSelf:'center'

},

});

<Text style={{fontSize:30, color: 'white'}}>Press</Text>


7. flashlist
<FlashList

data={DATA}

renderItem={({ item }) => (

<Text>{item.title}</Text>

)}

keyExtractor={(item) => item.id}

estimatedItemSize={50}

/>

8. splashscreen
SplashScreen.preventAutoHideAsync();
SplashScreen.hideAsync();

9.start
npx create-expo-app@latest
StickerSmash --template blank
npm i

10.object
et userObj = {
"name": "mohan",
"age": "89"
}
userObj.name
11.array
let userarray = [
{
"name": "mohan",
"age": "89"
},
{
"name": "Bamidu",
"age": "18"
}
]

console.log(userarray [0])

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy