@@ -14,6 +14,7 @@ import {
1414 StyleSheet ,
1515 ActivityIndicator ,
1616 Keyboard ,
17+ I18nManager ,
1718} from 'react-native' ;
1819
1920const styles = StyleSheet . create ( {
@@ -35,7 +36,6 @@ const styles = StyleSheet.create({
3536 transform : [ { translateY : - 10 } ] ,
3637 } ,
3738 rtlText : {
38- textAlign : 'right' ,
3939 writingDirection : 'rtl' ,
4040 } ,
4141 suggestionsContainer : {
@@ -61,9 +61,6 @@ const styles = StyleSheet.create({
6161 marginTop : 2 ,
6262 textAlign : 'left' ,
6363 } ,
64- leftAligned : {
65- left : 15 ,
66- } ,
6764 rightAligned : {
6865 right : 15 ,
6966 } ,
@@ -143,7 +140,7 @@ const GooglePlacesTextInput = forwardRef(
143140 const headers = {
144141 'Content-Type' : 'application/json' ,
145142 } ;
146- if ( apiKey || apiKey != '' ) {
143+ if ( apiKey || apiKey !== '' ) {
147144 headers [ 'X-Goog-Api-Key' ] = apiKey ;
148145 }
149146 const response = await fetch ( API_URL , {
@@ -202,8 +199,7 @@ const GooglePlacesTextInput = forwardRef(
202199 } ;
203200
204201 // Update text alignment based on language
205- const isRTL =
206- languageCode ?. startsWith ( 'he' ) || languageCode ?. startsWith ( 'ar' ) ;
202+ const isRTL = I18nManager . isRTL ;
207203
208204 const renderSuggestion = ( { item } ) => {
209205 const { mainText, secondaryText } = item . placePrediction . structuredFormat ;
@@ -276,14 +272,10 @@ const GooglePlacesTextInput = forwardRef(
276272 onChangeText = { handleTextChange }
277273 onFocus = { handleFocus }
278274 onBlur = { ( ) => setShowSuggestions ( false ) }
279- textAlign = { isRTL ? 'right' : 'left' }
280275 />
281276 { loading && showLoadingIndicator && (
282277 < ActivityIndicator
283- style = { [
284- styles . loadingIndicator ,
285- isRTL ? styles . leftAligned : styles . rightAligned ,
286- ] }
278+ style = { [ styles . loadingIndicator , styles . rightAligned ] }
287279 size = { 'small' }
288280 color = { style . loadingIndicator ?. color || '#000000' } // Default color
289281 />
0 commit comments