Skip to content

Commit

Permalink
Add specs for ModalManager (#24896)
Browse files Browse the repository at this point in the history
Summary:
Part of #24875

## Changelog
[General] [Added] - Add TurboModule spec for ModalManager
Pull Request resolved: #24896

Reviewed By: rickhanlonii

Differential Revision: D15471097

Pulled By: fkgozali

fbshipit-source-id: 99671583ddc2a6fc32fd1bcf9a6e340ad93a27c2
  • Loading branch information
abhiin1947 authored and facebook-github-bot committed May 29, 2019
1 parent 5a5c28a commit a3479c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@
const AppContainer = require('../ReactNative/AppContainer');
const I18nManager = require('../ReactNative/I18nManager');
const NativeEventEmitter = require('../EventEmitter/NativeEventEmitter');
const NativeModules = require('../BatchedBridge/NativeModules');
import NativeModalManager from './NativeModalManager';
const Platform = require('../Utilities/Platform');
const React = require('react');
const PropTypes = require('prop-types');
const StyleSheet = require('../StyleSheet/StyleSheet');
const View = require('../Components/View/View');

const RCTModalHostView = require('./RCTModalHostViewNativeComponent');

const ModalEventEmitter =
Platform.OS === 'ios' && NativeModules.ModalManager
? new NativeEventEmitter(NativeModules.ModalManager)
Platform.OS === 'ios' && NativeModalManager != null
? new NativeEventEmitter(NativeModalManager)
: null;

import type EmitterSubscription from '../vendor/emitter/EmitterSubscription';
Expand Down
22 changes: 22 additions & 0 deletions Libraries/Modal/NativeModalManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

'use strict';

import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';

export interface Spec extends TurboModule {
// RCTEventEmitter
+addListener: (eventName: string) => void;
+removeListeners: (count: number) => void;
}

export default TurboModuleRegistry.get<Spec>('ModalManager');

0 comments on commit a3479c2

Please sign in to comment.