Commit 17545e18 authored by Niccolò Cantù's avatar Niccolò Cantù

add rn hide focus

parent 62cb5c5a
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/
# macOS
.DS_Store
import 'react-native-gesture-handler';
import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity, Body, Header, Title } from 'react-native';
function changeText(){
console.log("PIPPO");
}
export default class App extends React.Component{
state = {buttonText:"BUTTON 2", accessible:true}
changeText(){
this.setState({buttonText:"PIPPO2"})
}
hideFocus(){
console.log("Button clicked")
this.setState({accessible:false, buttonText:"BUTTON 2: I am no more focusable"})
}
render(){
return (
<>
<View style={styles.header}>
<Text style={styles.headerText}>RNChangeFocus</Text>
</View>
<View style={styles.container} >
<View>
<TouchableOpacity style={styles.button} onPress={() => this.hideFocus()} >
<Text>Press to make BUTTON 2 unfocusable</Text>
</TouchableOpacity>
</View>
<View>
<TouchableOpacity style={styles.button}>
<Text>BUTTON 1 </Text>
</TouchableOpacity>
</View>
<View importantForAccessibility={this.state.accessible ? "yes" : "no-hide-descendants" } accessible={this.state.accessible}>
<TouchableOpacity backgroundColor="" style={styles.button} importantForAccessibility={this.state.accessible ? "yes" : "no-hide-descendants" } accessible={this.state.accessible}>
<Text>{this.state.buttonText}</Text>
</TouchableOpacity>
</View>
</View>
</>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
button: {
alignItems: 'center',
backgroundColor: '#DDDDDD',
padding: 10,
marginBottom: 20,
},
header: {
backgroundColor: '#008577',
paddingHorizontal: 20,
paddingVertical: 20,
marginTop: 20,
},
headerText: {
color: 'white',
},
});
{
"expo": {
"name": "RNHideFocus",
"slug": "RNHideFocus",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
This diff is collapsed.
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.6",
"@react-navigation/native": "^5.1.7",
"@react-navigation/stack": "^5.2.14",
"expo": "~37.0.3",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-gesture-handler": "~1.6.0",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "~2.2.0",
"react-native-web": "~0.11.7",
"react-navigation-stack": "^2.3.13"
},
"devDependencies": {
"babel-preset-expo": "~8.1.0",
"@babel/core": "^7.8.6"
},
"private": true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment