Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
a6c366e
[dev] upgrades RN to v0.48.0
sarahscott Sep 2, 2017
bba9acb
[Dev] Updated NetInfo event listener and snapshot tests for v0.48
sarahscott Sep 4, 2017
78396f1
[dev] First go at RCTEnclosingScrollView; does not work yet
sarahscott Sep 4, 2017
82220b6
[Dev] Finish upgrade of RCTEnclosingScrollView.
alloy Sep 4, 2017
e136078
[package] Upgrade Relay dependencies to modern.
alloy Jun 9, 2017
f907555
[package] Remove TS typings for Relay Classic.
alloy Jun 9, 2017
18173ca
[Relay] Rename all imports to use Classic mode.
alloy Jun 9, 2017
de5df9b
[relay] Setup relay-compiler
alloy Jun 9, 2017
2a67d51
[ts] Output ES2015 modules so babel-plugin-relay can find graphql calls.
alloy Jun 13, 2017
c0881f7
[ts] Fix import (squash)
alloy Jun 13, 2017
e0702fe
[package] Add relay-compiler-typescript transformer.
alloy Jun 13, 2017
c026abd
[git] Ignore build artefacts from relay-compiler.
alloy Jun 14, 2017
645315b
[package] Add relay-compiler to start command.
alloy Jun 14, 2017
83208ee
First working migrated file.
alloy Jun 14, 2017
f4ef0a6
Fixes after rebase.
alloy Jun 19, 2017
5615b79
[Artist] Migrate about tab to Relay Modern.
alloy Jun 19, 2017
62dde77
[Artist] Migrate shows tab to use Relay Modern.
alloy Jun 19, 2017
14511c2
[data] Update MP schema with root query type called ‘Query’.
alloy Jun 20, 2017
e1474ef
[ArtistArtworksGrid] First pass at using Relay modern. Needs more work.
alloy Jun 20, 2017
8dc0ad3
[Artist] Migrate container to Relay modern.
alloy Jun 20, 2017
ebf0332
More rebase fixes
alloy Jun 28, 2017
08b3728
[tsc] Add synthetic default imports to make momentjs+typings work again.
alloy Jun 28, 2017
9408a54
[WFU] Migrate container to Relay Modern.
alloy Jul 25, 2017
04fadba
[Gene] Fix default import of ParallaxScrollView
alloy Jul 25, 2017
a49b229
[typings] Import react-relay typings from Christina’s branch.
alloy Jul 26, 2017
6e40111
[typings] Alias react-relay modern to compat module.
alloy Jul 26, 2017
fe996b6
[Gene] Fix default import of remove-markdown.
alloy Jul 26, 2017
0812bcf
[Gene] Migrated to Relay Modern API
alloy Jul 26, 2017
85a9191
[typings] Add graphql.experimental alias.
alloy Jul 26, 2017
2ab583d
[Artist] Small cleanup
alloy Jul 26, 2017
987c541
[Gene] Actually wrap up refine refetching.
alloy Jul 28, 2017
2cc6ad1
[Home] Migrate to Relay Modern.
alloy Jul 28, 2017
12e26b6
[Artist] Migrate artworks component to Relay Modern.
alloy Jul 28, 2017
a999a5a
[Artist] Small cleanup.
alloy Jul 28, 2017
a54e1cc
Rename relay imports to use classic module after rebase.
alloy Jul 28, 2017
9bc3991
[Inquiry] Migrate to Relay Modern API.
alloy Aug 17, 2017
7057341
[vscode] Enable graphql intellisense/autocomplete etc.
alloy Aug 23, 2017
ce7b40f
[package] Remove unneeded TS transformer, we just do it in out fork.
alloy Aug 23, 2017
feffae0
[Inbox] Migrate to Relay Modern.
alloy Aug 23, 2017
0cf2b11
[Message] Fix default import of `moment`.
alloy Aug 23, 2017
10365c7
[Conversation] Migrate to Relay Modern API.
alloy Aug 24, 2017
8ed74ed
[typings] More relay mutations typings.
alloy Aug 24, 2017
ac79926
[MyAccount] Migrate to Relay Modern.
alloy Aug 24, 2017
ec7cf30
[stories] Disabled most that use Relay to work on after the migration.
alloy Aug 25, 2017
1902fc9
[Shows] For now disable dynamic Relay fragment selection based on dev…
alloy Aug 25, 2017
3467fa5
[relay] Add networking part of required modern tooling.
alloy Aug 25, 2017
cf802b1
[Invoice] Migrate to Relay Modern.
alloy Aug 25, 2017
263627e
[Relay] Convert routes to query renderers.
alloy Aug 25, 2017
57b668f
[relay] Replace classic environment with modern environment.
alloy Aug 25, 2017
fb0cab5
[relay] Remove classic code from config.
alloy Aug 25, 2017
0c6a63e
[relay] Replace all combat imports with modern.
alloy Aug 25, 2017
39bc4f6
[typings] Typings for QueryRenderer.
alloy Aug 25, 2017
cd5c1ed
[babel] No longer enable Relay compat mode.
alloy Aug 31, 2017
f1d9859
[Artist/Artworks] First pass
alloy Aug 31, 2017
8e8137a
[typings] export relay modern API by default
alloy Sep 1, 2017
6853480
[Artist/Artworks] Fix for sale and not for sale grids.
alloy Sep 1, 2017
c1e6bc3
[Gene] Make it work with Relay Modern.
alloy Sep 1, 2017
d47b67e
[WorksForYou] Make work with Relay Modern.
alloy Sep 1, 2017
0202d2b
[Inbox] Make it work with Relay Modern.
alloy Sep 1, 2017
86cd454
Cleanups.
alloy Sep 1, 2017
1fa0401
[Home] Make work with Relay Modern.
alloy Sep 2, 2017
4c37db2
[Conversation] Make mutation (sans optimistic response) work.
alloy Sep 4, 2017
b6f2c5f
[Conversation] Make optimistic response when sending a message work.
alloy Sep 4, 2017
da46862
[typings] Update MutationConfig
alloy Sep 4, 2017
662f319
[package] Add missing Relay dev modules.
alloy Sep 4, 2017
9358dc5
[package] Update Relay to use our forked packages of v1.3.0
alloy Sep 5, 2017
90929dd
[tests] Update react-relay mock
l2succes Sep 5, 2017
03c160b
[tests] Update test suite for RN 0.48 and relay modern
l2succes Sep 6, 2017
11dd1ef
[tests] Updates jest
l2succes Sep 6, 2017
b2c1241
[tests] fixes gene test
l2succes Sep 6, 2017
f568761
[tests] remove unneeded objects in mock
l2succes Sep 6, 2017
032e6cf
[tests] Update jest snapshots svg to support Jest 21
orta Sep 6, 2017
ee8f0f9
[ts] Updates react types and fix TS errors
l2succes Sep 7, 2017
41e8b5a
Updates package.json
l2succes Sep 7, 2017
43add87
Merge pull request #735 from artsy/relay-modern-tests
Sep 7, 2017
c84b21c
Merge branch 'master' of github.com:artsy/emission into relay-modern
l2succes Sep 7, 2017
8019aed
[tests] update snapshots
l2succes Sep 7, 2017
0d62238
Removes unused dep
l2succes Sep 7, 2017
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
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["./data/schema"],
"plugins": ["relay"],
"presets": ["react-native"]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Build generated
build/
DerivedData
__generated__
dist

## Various settings
*.pbxuser
Expand Down
20 changes: 20 additions & 0 deletions .gqlconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"schema": {
"files": "data/schema.graphql"
},
"query": {
"files": [
{
"match": "src/**/*.ts*",
"parser": ["EmbeddedQueryParser", { "startTag": "graphql(\\.experimental)?`", "endTag": "`" }],
"isRelay": true,
"validate": {
"extends": "gql-rules-query-relay",
"rules": {
"KnownDirectives": "off"
}
}
}
]
}
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

###### Dev

- Upgrades React Native to v0.48.0 - sarah
- Extracts connectivity banner into its own component - sarah
- Adds stylelint to the dev-experience, not validated on CI yet - orta
- Updates Storybooks to 3.2 - orta
Expand Down
55 changes: 29 additions & 26 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ PODS:
- Artsy+UIColors
- Artsy+UIFonts (>= 3.0.0)
- Extraction (>= 1.2.1)
- React/BatchedBridge (= 0.45.0-rc.2)
- React/Core (= 0.45.0-rc.2)
- React/RCTAnimation (= 0.45.0-rc.2)
- React/RCTCameraRoll (= 0.45.0-rc.2)
- React/RCTImage (= 0.45.0-rc.2)
- React/RCTNetwork (= 0.45.0-rc.2)
- React/RCTText (= 0.45.0-rc.2)
- React/BatchedBridge (= 0.48.0)
- React/Core (= 0.48.0)
- React/RCTAnimation (= 0.48.0)
- React/RCTCameraRoll (= 0.48.0)
- React/RCTImage (= 0.48.0)
- React/RCTNetwork (= 0.48.0)
- React/RCTText (= 0.48.0)
- SDWebImage (< 4, >= 3.7.2)
- SentryReactNative (= 0.14.5)
- Yoga (= 0.45.0-rc.2.React)
- Yoga (= 0.48.0.React)
- Extraction (1.2.3):
- Extraction/ARAnimationContinuation (= 1.2.3)
- Extraction/ARLoadFailureView (= 1.2.3)
Expand Down Expand Up @@ -63,33 +63,36 @@ PODS:
- NSURL+QueryDictionary (1.2.0)
- ORStackView (2.0.3):
- FLKAutoLayout
- React (0.45.0-rc.2):
- React/Core (= 0.45.0-rc.2)
- React/BatchedBridge (0.45.0-rc.2):
- React (0.48.0):
- React/Core (= 0.48.0)
- React/BatchedBridge (0.48.0):
- React/Core
- React/cxxreact_legacy
- React/Core (0.45.0-rc.2):
- Yoga (= 0.45.0-rc.2.React)
- React/cxxreact_legacy (0.45.0-rc.2):
- React/Core (0.48.0):
- Yoga (= 0.48.0.React)
- React/cxxreact_legacy (0.48.0):
- React/jschelpers_legacy
- React/DevSupport (0.45.0-rc.2):
- React/DevSupport (0.48.0):
- React/Core
- React/RCTWebSocket
- React/jschelpers_legacy (0.45.0-rc.2)
- React/RCTAnimation (0.45.0-rc.2):
- React/jschelpers_legacy (0.48.0)
- React/RCTAnimation (0.48.0):
- React/Core
- React/RCTCameraRoll (0.45.0-rc.2):
- React/RCTBlob (0.48.0):
- React/Core
- React/RCTCameraRoll (0.48.0):
- React/Core
- React/RCTImage
- React/RCTImage (0.45.0-rc.2):
- React/RCTImage (0.48.0):
- React/Core
- React/RCTNetwork
- React/RCTNetwork (0.45.0-rc.2):
- React/RCTNetwork (0.48.0):
- React/Core
- React/RCTText (0.45.0-rc.2):
- React/RCTText (0.48.0):
- React/Core
- React/RCTWebSocket (0.45.0-rc.2):
- React/RCTWebSocket (0.48.0):
- React/Core
- React/RCTBlob
- SAMKeychain (1.5.0)
- SDWebImage (3.7.5):
- SDWebImage/Core (= 3.7.5)
Expand All @@ -104,7 +107,7 @@ PODS:
- Sentry (~> 3.1.2)
- Sentry/KSCrash (~> 3.1.2)
- UIView+BooleanAnimations (1.0.2)
- Yoga (0.45.0-rc.2.React)
- Yoga (0.48.0.React)

DEPENDENCIES:
- AppHub (from `https://github.com/orta/apphub.git`, branch `build_list`)
Expand Down Expand Up @@ -151,20 +154,20 @@ SPEC CHECKSUMS:
Artsy+UIColors: 31c03c4146f5e6618a9b950f37dfe02dd9ac09a6
Artsy+UIFonts: e66afb5c40100e2fc5bba28feb7487e252f2d06f
Artsy-UIButtons: cdcc3ccf4d0d31ee80f45c1d11ffd2d772695b74
Emission: 6fc77205363e5070b0d4a99bf38a0763ea87b543
Emission: 7cd023eeebd140217dc39f30b311a402af4ac4bc
Extraction: 612cf0866f74d4c0dd616677ff24146efa200958
FLKAutoLayout: 106b14dbae09d32c6730190f4e78a959759ba4a4
ISO8601DateFormatter: 4551b6ce4f83185425f583b0b3feb3c7b59b942c
KSCrash: 7bd106ca4a2247774deeeb587c740ce0207de8f3
NSURL+QueryDictionary: bae616404e2adf6409d3d5c02a093cbf44c8a236
ORStackView: b9507271cb41fb9e0b3eecc6414d831201e7cf7c
React: c30b44eb8e84d2071fb78cd1ed58e1512a822a57
React: 830e32675a1cef76f854240fbda322282b150f98
SAMKeychain: 1fc9ae02f576365395758b12888c84704eebc423
SDWebImage: 69c6303e3348fba97e03f65d65d4fbc26740f461
Sentry: 5a578891f177e994d89d57effc70adb97bfb29db
SentryReactNative: 8f251df76f03c5ee42e702f37a41803709632217
UIView+BooleanAnimations: a760be9a066036e55f298b7b7350a6cb14cfcd97
Yoga: d43165f478a090e7b603edc5796965a1de27d473
Yoga: 056a82a5b4abd6b145f3d341176406e7174afff6

PODFILE CHECKSUM: 0c385e9313daa3b7b7130176793f59f9c6ee2778

Expand Down
168 changes: 91 additions & 77 deletions Pod/Classes/Core/RCTScrollView+EnclosingScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,98 +21,107 @@
@interface RCTScrollEvent : NSObject <RCTEvent>
- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
scrollView:(UIScrollView *)scrollView
scrollViewContentOffset:(CGPoint)scrollViewContentOffset
scrollViewContentInset:(UIEdgeInsets)scrollViewContentInset
scrollViewContentSize:(CGSize)scrollViewContentSize
scrollViewFrame:(CGRect)scrollViewFrame
scrollViewZoomScale:(CGFloat)scrollViewZoomScale
userData:(NSDictionary *)userData
coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER;
@end


@interface RCTDescendantScrollEvent : RCTScrollEvent
@property (nonatomic, strong, readonly) NSDictionary *body;
@end

@implementation RCTDescendantScrollEvent
{
NSDictionary *__userData;
UIScrollView *__scrollView;
UIScrollView *_enclosingScrollView;
}

@synthesize body = _body;

- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
scrollView:(UIScrollView *)scrollView
enclosingScrollView:(UIScrollView *)enclosingScrollView
scrollViewContentOffset:(CGPoint)scrollViewContentOffset
scrollViewContentInset:(UIEdgeInsets)scrollViewContentInset
scrollViewContentSize:(CGSize)scrollViewContentSize
scrollViewZoomScale:(CGFloat)scrollViewZoomScale
enclosingScrollViewFrame:(CGRect)enclosingScrollViewFrame
userData:(NSDictionary *)userData
coalescingKey:(uint16_t)coalescingKey
{
if ((self = [super initWithEventName:eventName
reactTag:reactTag
scrollView:scrollView
userData:userData
coalescingKey:coalescingKey])) {
__userData = userData;
__scrollView = scrollView;
_enclosingScrollView = enclosingScrollView;
// Use the enclosing scrollview’s dimensions for `scrollViewFrame``, because it is likely that the receiver wants to
// do calculations based on the location of the content in the enclosing scrollview.
if ((self = [super initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
scrollViewContentOffset:(CGPoint)scrollViewContentOffset
scrollViewContentInset:(UIEdgeInsets)scrollViewContentInset
scrollViewContentSize:(CGSize)scrollViewContentSize
scrollViewFrame:(CGRect)enclosingScrollViewFrame
scrollViewZoomScale:(CGFloat)scrollViewZoomScale
userData:(NSDictionary *)userData
coalescingKey:(uint16_t)coalescingKey])) {
// Theoretically it’s probably better to calculate this once `body` is actually used (which is what the superclass
// does) but that probably works in conjunction with coalescing, something we don’t do atm anyways.
NSDictionary *body = @{
@"contentOffset": @{
@"x": @(scrollViewContentOffset.x),
@"y": @(scrollViewContentOffset.y)
},
@"contentInset": @{
@"top": @(scrollViewContentInset.top),
@"left": @(scrollViewContentInset.left),
@"bottom": @(scrollViewContentInset.bottom),
@"right": @(scrollViewContentInset.right)
},
@"contentSize": @{
@"width": @(scrollViewContentSize.width),
@"height": @(scrollViewContentSize.height)
},
@"layoutMeasurement": @{
@"width": @(enclosingScrollViewFrame.size.width),
@"height": @(enclosingScrollViewFrame.size.height)
},
@"zoomScale": @(scrollViewZoomScale ?: 1),
};

if (userData) {
NSMutableDictionary *mutableBody = [body mutableCopy];
[mutableBody addEntriesFromDictionary:userData];
body = [mutableBody copy];
}

_body = body;
}
return self;
}

- (NSDictionary *)body
{
CGPoint originOffset = [__scrollView convertPoint:CGPointZero toView:_enclosingScrollView];

CGPoint contentOffset = _enclosingScrollView.contentOffset;
// TODO: contentOffset.x -= originOffset.x;
contentOffset.x = __scrollView.contentOffset.x;
contentOffset.y -= originOffset.y;

NSDictionary *body = @{
@"contentOffset": @{
@"x": @(contentOffset.x),
@"y": @(contentOffset.y)
},
@"contentInset": @{
@"top": @(__scrollView.contentInset.top),
@"left": @(__scrollView.contentInset.left),
@"bottom": @(__scrollView.contentInset.bottom),
@"right": @(__scrollView.contentInset.right)
},
@"contentSize": @{
@"width": @(__scrollView.contentSize.width),
@"height": @(__scrollView.contentSize.height)
},
// Use the enclosing scrollview’s dimensions here, because it is likely that the receiver
// wants to do calculations based on the location of the content in the enclosing scrollview.
@"layoutMeasurement": @{
@"width": @(_enclosingScrollView.frame.size.width),
@"height": @(_enclosingScrollView.frame.size.height)
},
@"zoomScale": @(__scrollView.zoomScale ?: 1),
};

if (__userData) {
NSMutableDictionary *mutableBody = [body mutableCopy];
[mutableBody addEntriesFromDictionary:__userData];
body = mutableBody;
}

return body;
}

@end


@implementation RCTScrollEvent (RCTEnclosingScrollView)

- (RCTDescendantScrollEvent *)scrollEventRelativeToDescendant:(UIScrollView *)descendantScrollView
reactTag:(NSNumber *)reactTag
coalescingKey:(uint16_t)coalescingKey
- (RCTDescendantScrollEvent *)scrollEventForScrollView:(UIScrollView *)scrollView
relativeFromEnclosingScrollView:(UIScrollView *)enclosingScrollView
reactTag:(NSNumber *)reactTag
coalescingKey:(uint16_t)coalescingKey
{
// TODO: Is this not simply scrollView.frame.origin ?
CGPoint originOffset = [scrollView convertPoint:CGPointZero toView:enclosingScrollView];
CGPoint contentOffset = enclosingScrollView.contentOffset;
// TODO: contentOffset.x -= originOffset.x;
contentOffset.x = scrollView.contentOffset.x;
contentOffset.y -= originOffset.y;

return [[RCTDescendantScrollEvent alloc] initWithEventName:self.eventName
reactTag:reactTag
scrollView:descendantScrollView
enclosingScrollView:[self valueForKey:@"_scrollView"]
scrollViewContentOffset:contentOffset
scrollViewContentInset:scrollView.contentInset
scrollViewContentSize:scrollView.contentSize
scrollViewZoomScale:scrollView.zoomScale
enclosingScrollViewFrame:enclosingScrollView.frame
userData:[self valueForKey:@"_userData"]
coalescingKey:coalescingKey];

}

@end
Expand All @@ -136,10 +145,10 @@ - (void)sendScrollEventWithName:(NSString *)eventName
// userData:userData
// coalescingKey:_coalescingKey];
// [_eventDispatcher sendEvent:scrollEvent];


uint16_t coalescingKey = [[self valueForKey:@"_coalescingKey"] unsignedIntegerValue];

if (![eventName isEqualToString:[self valueForKey:@"_lastEmittedEventName"]]) {
coalescingKey++;
[self setValue:@(coalescingKey) forKey:@"_coalescingKey"];
Expand All @@ -148,7 +157,11 @@ - (void)sendScrollEventWithName:(NSString *)eventName

RCTScrollEvent *scrollEvent = [[RCTScrollEvent alloc] initWithEventName:eventName
reactTag:self.reactTag
scrollView:scrollView
scrollViewContentOffset:self.scrollView.contentOffset
scrollViewContentInset:self.contentInset
scrollViewContentSize:self.contentSize
scrollViewFrame:self.frame
scrollViewZoomScale:self.scrollView.zoomScale
userData:userData
coalescingKey:coalescingKey];
[[self valueForKey:@"_eventDispatcher"] sendEvent:scrollEvent];
Expand All @@ -164,33 +177,34 @@ - (void)_enclosingRCTScrollViewEvent:(NSNotification *)notification;
// I was not able to find a great place in RN where the ancestor view hierarchy
// is guaranteed to exist.
//
RCTScrollView *scrollView = notification.object;
RCTScrollView *enclosingScrollView = notification.object;
// Only handle events of scrollviews that actually enclose this scrollview.
if (scrollView == self || ![self isDescendantOfView:scrollView]) {
if (enclosingScrollView == self || ![self isDescendantOfView:enclosingScrollView]) {
return;
}

// TODO: This is even more of a hack than all the rest of the change!!!
// The enclosing scroll view *must* have a throttle amount set or
// it won’t send more scroll move events.
//
if (scrollView.scrollEventThrottle == 0) {
scrollView.scrollEventThrottle = self.scrollEventThrottle;
if (enclosingScrollView.scrollEventThrottle == 0) {
enclosingScrollView.scrollEventThrottle = self.scrollEventThrottle;
}

RCTScrollEvent *scrollEvent = notification.userInfo[@"event"];

uint16_t coalescingKey = [[self valueForKey:@"_coalescingKey"] unsignedIntegerValue];

if (![scrollEvent.eventName isEqualToString:[self valueForKey:@"_lastEmittedEventName"]]) {
coalescingKey++;
[self setValue:@(coalescingKey) forKey:@"_coalescingKey"];
[self setValue:scrollEvent.eventName forKey:@"_lastEmittedEventName"];
}

scrollEvent = [scrollEvent scrollEventRelativeToDescendant:self.scrollView
reactTag:self.reactTag
coalescingKey:coalescingKey];
scrollEvent = [scrollEvent scrollEventForScrollView:self.scrollView
relativeFromEnclosingScrollView:enclosingScrollView.scrollView
reactTag:self.reactTag
coalescingKey:coalescingKey];
[[self valueForKey:@"_eventDispatcher"] sendEvent:scrollEvent];
}

Expand Down
Loading