From 930a84444cf676602586f149d3e5ca67767d28fb Mon Sep 17 00:00:00 2001 From: Ethan Sharabi <1780255+ethanshar@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:45:12 +0200 Subject: [PATCH 1/5] refactor: rename hint rendering methods for clarity --- src/components/hint/index.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/hint/index.tsx b/src/components/hint/index.tsx index b9ba98765d..5a9e5f1f04 100644 --- a/src/components/hint/index.tsx +++ b/src/components/hint/index.tsx @@ -302,7 +302,6 @@ class Hint extends Component { return TARGET_POSITIONS.LEFT; } } - return TARGET_POSITIONS.CENTER; } @@ -451,7 +450,7 @@ class Hint extends Component { return ; } - renderContent() { + renderHint() { const { message, messageStyle, @@ -491,7 +490,7 @@ class Hint extends Component { ); } - renderHint() { + renderHintContainer() { const {onPress, testID} = this.props; const opacity = onPress ? 0.9 : 1.0; @@ -510,7 +509,7 @@ class Hint extends Component { testID={testID} > - {this.renderContent()} + {this.renderHint()} {this.renderHintTip()} @@ -518,7 +517,7 @@ class Hint extends Component { } } - renderHintContainer() { + renderHintAnchor() { const {style, ...others} = this.props; return ( { testID={undefined} style={[styles.container, style, this.getContainerPosition(), !this.isUsingModal() && styles.overlayContainer]} > - {this.renderHint()} + {this.renderHintContainer()} ); } @@ -592,13 +591,13 @@ class Hint extends Component { testID={`${testID}.modal`} > {this.renderMockChildren()} - {this.renderHintContainer()} + {this.renderHintAnchor()} ) : ( <> {this.renderOverlay()} {this.renderMockChildren()} - {this.renderHintContainer()} + {this.renderHintAnchor()} )} From 084f15049e40e8769ddc47fb2ed75931e6e43fc5 Mon Sep 17 00:00:00 2001 From: Ethan Sharabi <1780255+ethanshar@users.noreply.github.com> Date: Wed, 25 Dec 2024 17:13:30 +0200 Subject: [PATCH 2/5] fix: add second hint toggle and adjust hint message positioning --- .../screens/componentScreens/HintsScreen.tsx | 20 +++++++++ src/components/hint/index.tsx | 44 ++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/demo/src/screens/componentScreens/HintsScreen.tsx b/demo/src/screens/componentScreens/HintsScreen.tsx index 2b2885d13d..9795f4b264 100644 --- a/demo/src/screens/componentScreens/HintsScreen.tsx +++ b/demo/src/screens/componentScreens/HintsScreen.tsx @@ -12,6 +12,7 @@ type HintScreenProps = {}; export default class HintsScreen extends Component { state = { showHint: true, + showSecondHint: false, useShortMessage: false, showBottomHint: false, showIcon: false, @@ -28,6 +29,10 @@ export default class HintsScreen extends Component { this.setState({showHint: !this.state.showHint}); }; + toggleSecondHint = () => { + this.setState({showSecondHint: !this.state.showSecondHint}); + }; + toggleHintPosition = () => { this.setState({ showBottomHint: !this.state.showBottomHint @@ -118,6 +123,7 @@ export default class HintsScreen extends Component { render() { const { showHint, + showSecondHint, showBottomHint, showIcon, targetPosition, @@ -215,6 +221,20 @@ export default class HintsScreen extends Component { )} + + + {targetPosition !== 'flex-start' && Text pushing button} + +