Skip to content

Commit

Permalink
Merge branch 'main' into @kudo/eng-6538-react-native-communityslider …
Browse files Browse the repository at this point in the history
…[skip ci]
  • Loading branch information
Kudo committed Oct 7, 2022
2 parents 7b7d82e + e3115b1 commit e2662f8
Show file tree
Hide file tree
Showing 429 changed files with 7,832 additions and 10,103 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,13 +7,19 @@ Package-specific changes not released in any SDK will be added here just before

### 📚 3rd party library updates

- Updated `react-native-safe-area-context` from `4.3.1` to `4.4.1`. ([#19055](https://github.com/expo/expo/pull/19401) by [@brentvatne](https://github.com/brentvatne))
- Updated `@stripe/stripe-react-native` from `0.13.1` to `0.18.1` on iOS. ([#19055](https://github.com/expo/expo/pull/19055) by [@tsapeta](https://github.com/tsapeta))
- Updated `@shopify/flash-list` from `1.1.0` to `1.3.0`. ([#19317](https://github.com/expo/expo/pull/19317) by [@kudo](https://github.com/kudo))
- Updated `react-native-view-shot` from `3.3.0` to `3.4.0`. ([#19405](https://github.com/expo/expo/pull/19405) by [@douglowder](https://github.com/douglowder))
- Updated `react-native-webview` from `11.23.0` to `11.23.1`. ([#19375](https://github.com/expo/expo/pull/19375) by [@aleqsio](https://github.com/aleqsio))
- Updated `react-native-gesture-handler` from `2.5.0` to `2.7.0`. ([#19362](https://github.com/expo/expo/pull/19362) by [@tsapeta](https://github.com/tsapeta))
- Updated `@react-native-community/netinfo` from `9.3.0` to `9.3.3`. ([#19421](https://github.com/expo/expo/pull/19421) by [@douglowder](https://github.com/douglowder))
- Updated `@react-native-picker/picker` from `2.4.2` to `2.4.6`. ([#19390](https://github.com/expo/expo/pull/19390) by [@aleqsio](https://github.com/aleqsio))
- Updated `react-native-screens` from `3.15.0` to `3.18.0`. ([#19383](https://github.com/expo/expo/pull/19383) by [@tsapeta](https://github.com/tsapeta))
- Updated `@shopify/react-native-skia` from `0.1.136` to `0.1.153`. ([#19360](https://github.com/expo/expo/pull/19360) by [@kudo](https://github.com/kudo))
- Updated `@react-native-community/datetimepicker` from `6.2.0` to `6.5.0`. ([#19419](https://github.com/expo/expo/pull/19419) by [@byCedric](https://github.com/byCedric))
- Updated `react-native-maps` from `0.31.1` to `1.3.2`. ([#19414](https://github.com/expo/expo/pull/19414) by [@aleqsio](https://github.com/aleqsio))
- Updated `lottie-react-native` from `5.1.3` to `5.1.4`. ([#19433](https://github.com/expo/expo/pull/19433) by [@kudo](https://github.com/kudo))
- Updated `@react-native-community/slider` from `4.2.3` to `4.2.4`. ([#19424](https://github.com/expo/expo/pull/19424)) by [@kudo](https://github.com/kudo))

### 🛠 Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions android/expoview/build.gradle
Expand Up @@ -357,9 +357,9 @@ dependencies {

api 'com.squareup.picasso:picasso:2.5.2'
api 'com.google.android.gms:play-services-analytics:17.0.0'
api 'com.google.android.gms:play-services-maps:18.0.0'
api 'com.google.android.gms:play-services-maps:18.0.1'
api 'com.google.android.gms:play-services-auth:17.0.0'
api 'com.google.android.gms:play-services-location:17.0.0'
api 'com.google.android.gms:play-services-location:20.0.0'
api 'com.google.android.gms:play-services-fitness:17.0.0'
api 'com.google.android.gms:play-services-wallet:17.0.0' //may need 10.+
debugApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
Expand Down
Expand Up @@ -76,7 +76,7 @@ private boolean isSpinner() {
* @return returns 'real' minutes (0-59)
*/
private int getRealMinutes(int minutesOrSpinnerIndex) {
if (mDisplay == RNTimePickerDisplay.SPINNER) {
if (isSpinner()) {
return minutesOrSpinnerIndex * mTimePickerInterval;
}

Expand Down Expand Up @@ -147,27 +147,42 @@ private void correctEnteredMinutes(final TimePicker view, final int hourOfDay, f
runnable = new Runnable() {
@Override
public void run() {
// set valid hour & minutes
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
view.setHour(hourOfDay);
view.setMinute(correctedMinutes);
} else {
view.setCurrentHour(hourOfDay);
// we need to set minutes to 0 for this to work on older android devices
view.setCurrentMinute(0);
view.setCurrentMinute(correctedMinutes);
}
if (pickerIsInTextInputMode()) {
// move caret to the end of input
View maybeTextInput = view.findFocus();
if (maybeTextInput instanceof EditText) {
final EditText textInput = (EditText) maybeTextInput;
textInput.setSelection(textInput.getText().length());
} else {
Log.e("RN-datetimepicker", "could not set selection on time picker, this is a known issue on some Huawei devices");
}
}
if (pickerIsInTextInputMode()) {
// only rewrite input when the value makes sense to be corrected
// eg. given interval 3, when user wants to enter 53
// we don't rewrite the first number "5" to 6, because it would be confusing
// but the value will be corrected in onTimeChanged()
// however, when they enter 10, we rewrite it to 9
boolean canRewriteTextInput = correctedMinutes > 5;
if (!canRewriteTextInput) {
return;
}
fixTime();
moveCursorToEnd();
} else {
fixTime();
}
}
private void fixTime() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
view.setHour(hourOfDay);
view.setMinute(correctedMinutes);
} else {
view.setCurrentHour(hourOfDay);
// we need to set minutes to 0 first for this to work on older android devices
view.setCurrentMinute(0);
view.setCurrentMinute(correctedMinutes);
}
}
private void moveCursorToEnd() {
View maybeTextInput = view.findFocus();
if (maybeTextInput instanceof EditText) {
final EditText textInput = (EditText) maybeTextInput;
textInput.setSelection(textInput.getText().length());
} else {
Log.e("RN-datetimepicker", "could not set selection on time picker, this is a known issue on some Huawei devices");
}
}
};

handler.postDelayed(runnable, 500);
Expand All @@ -191,15 +206,17 @@ public void onTimeChanged(final TimePicker view, final int hourOfDay, final int

@Override
public void onClick(DialogInterface dialog, int which) {
if (mTimePicker != null && which == BUTTON_POSITIVE && timePickerHasCustomMinuteInterval()) {
final int hours = mTimePicker.getCurrentHour();

final int realMinutes = getRealMinutes();
int validMinutes = isSpinner() ? realMinutes : snapRealMinutesToInterval(realMinutes);

if (mTimeSetListener != null) {
mTimeSetListener.onTimeSet(mTimePicker, hours, validMinutes);
}
boolean needsCustomHandling = timePickerHasCustomMinuteInterval() || isSpinner();
if (mTimePicker != null && which == BUTTON_POSITIVE && needsCustomHandling) {
mTimePicker.clearFocus();
final int hours = mTimePicker.getCurrentHour();
int realMinutes = getRealMinutes();
int reportedMinutes = timePickerHasCustomMinuteInterval()
? snapRealMinutesToInterval(realMinutes)
: realMinutes;
if (mTimeSetListener != null) {
mTimeSetListener.onTimeSet(mTimePicker, hours, reportedMinutes);
}
} else {
super.onClick(dialog, which);
}
Expand Down Expand Up @@ -228,15 +245,19 @@ public void updateTime(int hourOfDay, int minuteOfHour) {
public void onAttachedToWindow() {
super.onAttachedToWindow();

int timePickerId = mContext.getResources().getIdentifier("timePicker", "id", "android");
mTimePicker = this.findViewById(timePickerId);

if (timePickerHasCustomMinuteInterval()) {
setupPickerDialog();
}
}

private void setupPickerDialog() {
int timePickerId = mContext.getResources().getIdentifier("timePicker", "id", "android");
mTimePicker = this.findViewById(timePickerId);

if (mTimePicker == null) {
Log.e("RN-datetimepicker", "time picker was null");
return;
}
int realMinuteBackup = mTimePicker.getCurrentMinute();

if (isSpinner()) {
Expand Down
Expand Up @@ -54,7 +54,7 @@ public DatePickerDialogListener(final Promise promise) {

@Override
public void onDateSet(DatePicker view, int year, int month, int day) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_DATE_SET);
result.putInt("year", year);
Expand All @@ -67,7 +67,7 @@ public void onDateSet(DatePicker view, int year, int month, int day) {

@Override
public void onDismiss(DialogInterface dialog) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_DISMISSED);
mPromise.resolve(result);
Expand All @@ -77,7 +77,7 @@ public void onDismiss(DialogInterface dialog) {

@Override
public void onClick(DialogInterface dialog, int which) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_NEUTRAL_BUTTON);
mPromise.resolve(result);
Expand Down
Expand Up @@ -106,5 +106,9 @@ private void fixSpinner(Context context, int year, int month, int dayOfMonth, RN
throw new RuntimeException(e);
}
}
if (display == RNDatePickerDisplay.SPINNER){
if(this.getDatePicker() != null)
this.getDatePicker().setCalendarViewShown(false);
}
}
}
Expand Up @@ -17,10 +17,10 @@
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.DialogInterface.OnClickListener;
import android.os.Build;
import android.os.Bundle;
import android.text.format.DateFormat;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

Expand All @@ -37,6 +37,7 @@ public class RNTimePickerDialogFragment extends DialogFragment {
@Nullable
private static OnClickListener mOnNeutralButtonActionListener;

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Bundle args = getArguments();
Expand Down Expand Up @@ -118,7 +119,7 @@ static TimePickerDialog createDialog(
}

@Override
public void onDismiss(DialogInterface dialog) {
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
if (mOnDismissListener != null) {
mOnDismissListener.onDismiss(dialog);
Expand Down
Expand Up @@ -19,6 +19,7 @@
import android.os.Bundle;
import android.widget.TimePicker;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
Expand All @@ -39,6 +40,7 @@ public RNTimePickerDialogModule(ReactApplicationContext reactContext) {
super(reactContext);
}

@NonNull
@Override
public String getName() {
return FRAGMENT_TAG;
Expand All @@ -54,7 +56,7 @@ public TimePickerDialogListener(Promise promise) {

@Override
public void onTimeSet(TimePicker view, int hour, int minute) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_TIME_SET);
result.putInt("hour", hour);
Expand All @@ -66,7 +68,7 @@ public void onTimeSet(TimePicker view, int hour, int minute) {

@Override
public void onDismiss(DialogInterface dialog) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_DISMISSED);
mPromise.resolve(result);
Expand All @@ -76,7 +78,7 @@ public void onDismiss(DialogInterface dialog) {

@Override
public void onClick(DialogInterface dialog, int which) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveCatalystInstance()) {
if (!mPromiseResolved && getReactApplicationContext().hasActiveReactInstance()) {
WritableMap result = new WritableNativeMap();
result.putString("action", RNConstants.ACTION_NEUTRAL_BUTTON);
mPromise.resolve(result);
Expand Down
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.WindowManager;

Expand All @@ -18,14 +17,10 @@ public class AirMapCircleManager extends ViewGroupManager<AirMapCircle> {

public AirMapCircleManager(ReactApplicationContext reactContext) {
super();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
metrics = new DisplayMetrics();
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()
.getRealMetrics(metrics);
} else {
metrics = reactContext.getResources().getDisplayMetrics();
}
metrics = new DisplayMetrics();
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()
.getRealMetrics(metrics);
}

@Override
Expand Down
Expand Up @@ -38,9 +38,7 @@ public class AirMapGradientPolyline extends AirMapFeature {

private GoogleMap map;

private TileOverlayOptions tileOverlayOptions;
private TileOverlay tileOverlay;
private AirMapGradientPolylineProvider tileProvider;
protected final Context context;

public AirMapGradientPolyline(Context context) {
Expand Down Expand Up @@ -88,8 +86,8 @@ public void setWidth(float width) {
private TileOverlayOptions createTileOverlayOptions() {
TileOverlayOptions options = new TileOverlayOptions();
options.zIndex(zIndex);
this.tileProvider = new AirMapGradientPolylineProvider(context, points, colors, width);
options.tileProvider(this.tileProvider);
AirMapGradientPolylineProvider tileProvider = new AirMapGradientPolylineProvider(context, points, colors, width);
options.tileProvider(tileProvider);
return options;
}

Expand Down
@@ -1,7 +1,6 @@
package versioned.host.exp.exponent.modules.api.components.maps;

import android.content.Context;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.WindowManager;

Expand All @@ -21,14 +20,10 @@ public class AirMapGradientPolylineManager extends ViewGroupManager<AirMapGradie

public AirMapGradientPolylineManager(ReactApplicationContext reactContext) {
super();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
metrics = new DisplayMetrics();
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()
.getRealMetrics(metrics);
} else {
metrics = reactContext.getResources().getDisplayMetrics();
}
metrics = new DisplayMetrics();
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()
.getRealMetrics(metrics);
}

@Override
Expand Down
Expand Up @@ -49,7 +49,7 @@ public void setGradient(Gradient gradient) {
}

public void setOpacity(double opacity) {
this.opacity = new Double(opacity);
this.opacity = opacity;
if (heatmapTileProvider != null) {
heatmapTileProvider.setOpacity(opacity);
}
Expand All @@ -59,7 +59,7 @@ public void setOpacity(double opacity) {
}

public void setRadius(int radius) {
this.radius = new Integer(radius);
this.radius = radius;
if (heatmapTileProvider != null) {
heatmapTileProvider.setRadius(radius);
}
Expand Down

0 comments on commit e2662f8

Please sign in to comment.