// @ts-nocheck
/*
* From the RNW docs:
* https://necolas.github.io/react-native-web/docs/?path=/docs/components-pressable--disabled#pressable
*/
import * as React from 'react';
import { Pressable, StyleSheet, Text, View, ScrollView } from 'react-native';
import { Page, Section } from '../components/Page';
export default function PressableScreen() {
return (
);
}
PressableScreen.navigationOptions = {
title: 'Pressable',
};
function DelayEvents() {
const [eventLog, updateEventLog] = React.useState([]);
const handlePress = (eventName: string) => {
return () => {
const limit = 6;
updateEventLog((state) => {
const nextState = state.slice(0, limit - 1);
nextState.unshift(eventName);
return nextState;
});
};
};
return (
Pressable
{eventLog.map((e, ii) => (
{e}
))}
);
}
function Disabled() {
return (
Disabled Pressable
Enabled Pressable
);
}
function FeedbackEvents() {
const [eventLog, updateEventLog] = React.useState([]);
const handlePress = (eventName: string) => {
return () => {
const limit = 6;
updateEventLog((state) => {
const nextState = state.slice(0, limit - 1);
nextState.unshift(eventName);
return nextState;
});
};
};
return (
Press Me
({
padding: 10,
margin: 10,
borderWidth: 1,
borderColor: focused ? 'blue' : null,
backgroundColor: pressed ? 'lightblue' : 'white',
})}>
({
padding: 10,
margin: 10,
borderWidth: 1,
borderColor: focused ? 'blue' : null,
backgroundColor: pressed ? 'lightblue' : 'white',
})}>
Nested pressables
{eventLog.map((e, ii) => (
{e}
))}
);
}
const action = (msg: string) => () => {
console.log(msg);
};
const styles = StyleSheet.create({
touchableText: {
borderRadius: 8,
padding: 5,
borderWidth: 1,
borderColor: 'black',
color: '#007AFF',
borderStyle: 'solid',
textAlign: 'center',
},
disabledTouchableText: {
borderRadius: 8,
padding: 5,
borderWidth: 1,
borderColor: 'gray',
color: 'gray',
borderStyle: 'solid',
textAlign: 'center',
},
eventLogBox: {
padding: 10,
marginTop: 10,
height: 120,
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#f0f0f0',
backgroundColor: '#f9f9f9',
},
row: {
justifyContent: 'center',
flexDirection: 'row',
},
block: {
padding: 10,
},
});