mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[firestore][DocumentSnapshot] explicitly bind context on data/get methods to keep context during destructuring (includes tests)
This commit is contained in:
@@ -55,15 +55,13 @@ export default class DocumentSnapshot {
|
||||
return this._ref;
|
||||
}
|
||||
|
||||
data(): Object | void {
|
||||
return this._data;
|
||||
}
|
||||
data = (): Object | void => this._data;
|
||||
|
||||
get(fieldPath: string | FieldPath): any {
|
||||
get = (fieldPath: string | FieldPath): any => {
|
||||
if (fieldPath instanceof FieldPath) {
|
||||
return extractFieldPathData(this._data, fieldPath._segments);
|
||||
}
|
||||
|
||||
return deepGet(this._data, fieldPath, '.');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user