Skip to content

Instantly share code, notes, and snippets.

@rotemmiz
rotemmiz / F8 dumpsys meminfo.md
Last active November 11, 2016 23:18
React Native Memory Footprint Benchmarks
Applications Memory Usage (kB):
Uptime: 89089252 Realtime: 262050357

** MEMINFO in pid 712 [com.facebook.f8] **
                   Pss  Private  Private  Swapped     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------
  Native Heap    28515    28372        0     1100    46208    41414     4793
  Dalvik Heap    45802    45476        0     7364    61380    55669     5711
@rotemmiz
rotemmiz / MyBridgedComponent.js
Last active October 3, 2016 22:49
Killing a webview bridge component
class MyBridgedComponent extends Component {
constructor(props) {
super(props);
this.state = {
isLoaded: false
};
}
onBridgeMessage(message) {
@rotemmiz
rotemmiz / MessageQueue Spy - layout.md
Last active October 22, 2016 20:59
[RN] MessageQueue spy - layout
2584 I ReactNativeJS: Running application "MoviesApp" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === false, development-level warning are OFF, performance optimizations are ON
2584 I ReactNativeJS: JS->N : UIManager.createView([4,"RCTView",1,{"flex":1,"overflow":"hidden","backgroundColor":-1}])
2584 I ReactNativeJS: JS->N : UIManager.createView([5,"RCTView",1,{"flex":1,"backgroundColor":0,"overflow":"hidden"}])
2584 I ReactNativeJS: JS->N : UIManager.createView([6,"RCTView",1,{"pointerEvents":"auto","position":"absolute","overflow":"hidden","left":0,"right":0,"bottom":0,"top":0}])
2584 I ReactNativeJS: JS->N : UIManager.createView([7,"RCTView",1,{"flex":1,"backgroundColor":-1}])
2584 I ReactNativeJS: JS->N : UIManager.createView([8,"RCTView",1,{"flexDirection":"row","alignItems":"center","backgroundColor":-5658199,"height":56}])
2584 I ReactNativeJS: JS->N : UIManager.createView([9,"RCTView",1,{"nativeBackgroundAndroid":{"type":"ThemeAttrAndroid","attribute":"selectableItemBackgroundBorderle
@rotemmiz
rotemmiz / MessageQueue Spy - network.md
Last active October 22, 2016 20:58
[RN] MessageQueue spy - network
5835 I ReactNativeJS: JS->N : Networking.sendRequest(["GET","http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=7waqfqbprs7pajbz28mqf6vz&page_limit=20&page=1",1,[],{"trackingName":"unknown"},"text",false,0])
5835 I ReactNativeJS: N->JS : RCTDeviceEventEmitter.emit(["didReceiveNetworkResponse",[1,200,{"Connection":"keep-alive","X-Xss-Protection":"1; mode=block","Content-Security-Policy":"frame-ancestors 'self' rottentomatoes.com *.rottentomatoes.com ;","Date":"Sat, 22 Oct 2016 13:58:53 GMT","Set-Cookie":"JSESSIONID=63B283B5ECAA9BBECAE253E44455F25B; Path=/; HttpOnly","Server":"nginx/1.8.1","X-Content-Type-Options":"nosniff","X-Mashery-Responder":"prod-j-worker-us-east-1b-115.mashery.com","Vary":"User-Agent,Accept-Encoding","Content-Language":"en-US","Content-Type":"text/javascript;charset=ISO-8859-1","X-Content-Security-Policy":"frame-ancestors 'self' rottentomatoes.com *.rottentomatoes.com ;"},"http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apike
@rotemmiz
rotemmiz / MessageQueue Spy - touch.md
Last active October 22, 2016 20:58
[RN] MessageQueue spy - touch
2584 I ReactNativeJS: N->JS : RCTEventEmitter.receiveTouches(["topTouchStart",[{"identifier":0,"locationY":47.9301872253418,"locationX":170.43936157226562,"pageY":110.02542877197266,"timestamp":2378613,"target":26,"pageX":245.4869842529297}],[0]])
2584 I ReactNativeJS: JS->N : Timing.createTimer([18,130,1477140761852,false])
2584 I ReactNativeJS: JS->N : Timing.createTimer([19,500,1477140761852,false])
2584 I ReactNativeJS: JS->N : UIManager.setJSResponder([23,false])
2584 I ReactNativeJS: N->JS : RCTEventEmitter.receiveTouches(["topTouchEnd",[{"identifier":0,"locationY":47.9301872253418,"locationX":170.43936157226562,"pageY":110.02542877197266,"timestamp":2378703,"target":26,"pageX":245.4869842529297}],[0]])
2584 I ReactNativeJS: JS->N : UIManager.clearJSResponder([])
2584 I ReactNativeJS: JS->N : Timing.deleteTimer([19])
2584 I ReactNativeJS: JS->N : Timing.deleteTimer([18])
@rotemmiz
rotemmiz / busyjsthread.js
Last active January 2, 2017 16:10
[RN] Busy JS thread example
class SearchBar extends React.Component {
render() {
...
return (
...
<TouchableOpacity onPress={this.actBusy.bind(this)}>
<View style={styles.button}>
<Text>Spam mqt_js</Text>
</View>
</TouchableOpacity>
@rotemmiz
rotemmiz / DetoxSignupExample.js
Last active September 9, 2017 11:32
Detox.Medium.DetoxSignupExample.js
describe('Login flow', () => {
it('should login successfully', async () => {
  await device.reloadReactNative();
  await expect(element(by.id('email'))).toBeVisible();
  await element(by.id('email')).typeText('[email protected]');
  await element(by.id('password')).typeText('123456');
  await element(by.text('Login')).tap();
@rotemmiz
rotemmiz / login.test.js
Created February 22, 2018 00:01
Detox: A Year in. Building It, Testing With It
describe('Login', () => {
const server = new MockServer();
beforeEach(async () => {
await server.start();
});
afterEach(async () => {
await server.stop();
});
@rotemmiz
rotemmiz / MockNotificationServer.js
Last active February 22, 2018 00:04
Detox: A Year in. Building It, Testing With It
class MockNotificationServer {
start({port}) {
this.app.post('/regiscribe', this.onRegiscribe.bind(this));
this.app.post('/unsubscribe', this.onUnsubscribe.bind(this));
this.server = this.app.listen(port);
}
reset() {
this.lastRegiscribe = {};
this.lastUnsubscribe = {};
@rotemmiz
rotemmiz / notifications.test.js
Created February 22, 2018 00:05
Detox: A Year in. Building It, Testing With It
it('should send push token to notification server after user allows push permissions', async () => {
appStateServer.forUser(appStateServer.testUserId()).withBusinesses(1);
await device.launchApp({delete: true});
await element(by.text('Log In TestUser1')).tap();
notificationServer.expectLastRegiscribe().toNotExist();
await element(by.text('Allow')).tap();
await expect(element(by.text('feed.FeedScreen'))).toBeVisible();
notificationServer.expectLastRegiscribe().toContain({appleDeviceToken: consts.DeviceToken});