1- import React , { useState } from 'react' ;
1+ import React , { useMemo , useState } from 'react' ;
22import { ScrollView , StyleSheet , Text , View } from 'react-native' ;
33import { NitroText , TextLayoutEvent } from 'react-native-nitro-text' ;
44
@@ -17,6 +17,14 @@ export default function App() {
1717 // setLayoutInfo(`Lines: ${lines.length}`);
1818 } ;
1919
20+ const menus = useMemo (
21+ ( ) => [
22+ { title : 'Ask ChatGPT' , action : ( ) => console . log ( 'Ask ChatGPT' ) } ,
23+ { title : 'Paste' , action : ( ) => console . log ( 'Paste' ) } ,
24+ ] ,
25+ [ ] ,
26+ ) ;
27+
2028 return (
2129 < ScrollView style = { styles . container } contentContainerStyle = { styles . content } >
2230 { /* Header Section */ }
@@ -61,7 +69,7 @@ export default function App() {
6169 { /* Rich Text Formatting */ }
6270 < View style = { styles . section } >
6371 < NitroText style = { styles . sectionTitle } > Rich Text Formatting</ NitroText >
64- < NitroText style = { styles . richText } >
72+ < NitroText selectable menus = { menus } style = { styles . richText } >
6573 Welcome to the world of{ ' ' }
6674 < NitroText style = { styles . bold } > bold text</ NitroText > ,{ ' ' }
6775 < NitroText style = { styles . italic } > beautiful italics</ NitroText > , and{ ' ' }
@@ -129,7 +137,11 @@ export default function App() {
129137 < View style = { styles . section } >
130138 < NitroText style = { styles . sectionTitle } > Line Limiting</ NitroText >
131139 < NitroText style = { styles . description } > Two lines maximum:</ NitroText >
132- < NitroText style = { styles . limitedText } numberOfLines = { 2 } ellipsizeMode = 'tail' >
140+ < NitroText
141+ style = { styles . limitedText }
142+ numberOfLines = { 2 }
143+ ellipsizeMode = "tail"
144+ >
133145 This is a very long text that would normally span multiple lines, but
134146 we're limiting it to just two lines. The text will be truncated with
135147 an ellipsis when it exceeds the specified number of lines. This is
0 commit comments