Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ const BlockDraggableWrapper = ( { children } ) => {
*/
const BlockDraggable = ( { clientId, children, enabled = true } ) => {
const wasBeingDragged = useRef( false );
const [ isEditingText, setIsEditingText ] = useState(
RCTAztecView.InputState.isFocused()
);
const [ isEditingText, setIsEditingText ] = useState( false );

const draggingAnimation = {
opacity: useSharedValue( 1 ),
Expand Down Expand Up @@ -327,6 +325,11 @@ const BlockDraggable = ( { clientId, children, enabled = true } ) => {
}, [] );

useEffect( () => {
const isAnyAztecInputFocused = RCTAztecView.InputState.isFocused();
if ( isAnyAztecInputFocused ) {
setIsEditingText( isAnyAztecInputFocused );
}

RCTAztecView.InputState.addFocusChangeListener( onFocusChangeAztec );
return () => {
RCTAztecView.InputState.removeFocusChangeListener(
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-aztec/src/AztecInputState.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const notifyInputChange = () => {
*/
export const focus = ( element ) => {
TextInputState.focusTextInput( element );
notifyInputChange();
};

/**
Expand All @@ -99,6 +100,7 @@ export const focus = ( element ) => {
*/
export const blur = ( element ) => {
TextInputState.blurTextInput( element );
notifyInputChange();
};

/**
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native-aztec/src/AztecView.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ class AztecView extends Component {
}

_onFocus( event ) {
AztecInputState.notifyInputChange();

if ( ! this.props.onFocus ) {
return;
}
Expand All @@ -136,7 +134,6 @@ class AztecView extends Component {
this.selectionEndCaretY = null;

AztecInputState.blur( this.aztecViewRef.current );
AztecInputState.notifyInputChange();

if ( ! this.props.onBlur ) {
return;
Expand Down